
<?php include_once(dirname(__FILE__).'/../general/head.php'); ?>

<!-- header -->
<?php include_once(dirname(__FILE__).'/../general/header.php'); ?>

<?php include_once('left.php'); ?>


<div id="page-wrapper">

    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">Các câu hỏi</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    Danh sách
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover sb-table">
                            <thead>
                                <tr>
                                    <th>Id</th>
                                    <th>Question</th>
                                    <th>Category</th>
                                    <th>Level</th>
                                    <th>&nbsp;</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                if ($result == false) {
                                    ?>
                                    <tr>
                                        <td colspan="5">
                                            No record found!
                                        </td>
                                    </tr>
                                    <?php
                                } else {
                                    foreach ($result as $row) {
                                        ?>
                                        <tr>
                                            <td><?php echo $row->qid; ?></td>
                                            <td><?php echo $row->question; ?></td>
                                            <td><?php echo $row->category_name; ?></td>
                                            <td><?php echo $row->level_name; ?></td>
                                            <td><a href="javascript: if(confirm('Bạn có chắc là muốn xóa không? question?')){ window.location='<?php echo site_url('qbank/remove_question/' . $row->qid); ?>'; }"><img src="<?php echo base_url(); ?>images/cross.png" title="Remove"></a>  <a href="<?php echo site_url('qbank/edit_question/' . $row->qid); ?>"><img src="<?php echo base_url(); ?>images/edit.png" title="Edit"></a></td>
                                        </tr>

                                    <?php }
                                } ?>

                            </tbody>
                        </table>
                        <br>
                        <a href="<?php echo site_url(get_folder($loggedUser['title']).'/questions/add_new');?>"> <img src="<?php echo base_url();?>images/plus.png" title="Thêm câu hỏi mới"> Thêm câu hỏi mới</a>
                    </div>

                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
            <div class="panel panel-default">
            <div class="panel-heading">
                    Upload câu hỏi
                </div>
<div class="panel-body">
                    <div class="table-responsive">
            <table id="detail" class="table table-bordered table-hover">
                <tr><td>	<?php echo form_open('qbank/import', array('enctype' => 'multipart/form-data')); ?>
                        <br><select name="cid">
                            <option value="0">Select Category</option>
                            <?php foreach ($category as $value) { ?>
                                <option value="<?php echo $value->cid; ?>"><?php echo $value->category_name; ?></option>
<?php } ?></select>

                        <select name="did">
                            <option value="0">Select level</option>
                            <?php foreach ($difficult_level as $value) { ?>
                                <option value="<?php echo $value->did; ?>"><?php echo $value->level_name; ?></option>
<?php } ?></select> 
                        Upload file excel (dạng .xls)
                        <br><br>
                        <input type="hidden" name="size" value="3500000">
                        <input type="file" name="xlsfile" >
                        <br>
                        <input type="submit" value="Import"></form><br></td></tr>
            </table>
                    </div></div>
    </div>
        </div>
        <!-- /.col-lg-12 -->
    </div>


</div>
<!-- /#page-wrapper -->

<?php include_once(dirname(__FILE__).'/../general/footer.php'); ?>